{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6205e902-6a33-4a47-a567-e1c41eb5df6f",
   "metadata": {
    "tags": []
   },
   "source": [
    "- [字体工具库(fontTools)深入理解和使用指南](https://blog.csdn.net/gitblog_01127/article/details/141047221)\n",
    "- [fonttools说明文档](https://fonttools.readthedocs.io/en/latest/index.html)\n",
    "- [使用fontTools解析字体文件name数据表](https://zhuanlan.zhihu.com/p/491175407)\n",
    "- [TTF字库文件格式详解](https://blog.csdn.net/qq582880551/article/details/127277269)\n",
    "- [字库：cmap 表](https://blog.csdn.net/ken2232/article/details/130884049)\n",
    "- [汉字字符集编码查询](https://www.qqxiuzi.cn/bianma/zifuji.php)\n",
    "- 打开字符映射表: 按下 Win + R 键，输入 charmap，然后按回车"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "46772ee4-7d12-4cef-a0d3-4cc58b0bad8a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from fontTools import ttLib, cffLib"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "600765c6-0d69-4dee-a737-4cd7bd2fbb8d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "font type: <class 'fontTools.ttLib.ttFont.TTFont'>\n",
      "font.keys():  ['GlyphOrder', 'head', 'hhea', 'maxp', 'OS/2', 'hmtx', 'LTSH', 'VDMX', 'hdmx', 'cmap', 'fpgm', 'prep', 'cvt ', 'loca', 'glyf', 'kern', 'name', 'post', 'gasp', 'GDEF', 'GPOS', 'meta', 'DSIG']\n",
      "font['cmap']:  <'cmap' table at 2a9573627e0>\n",
      "font['cmap'].tables: [<fontTools.ttLib.tables._c_m_a_p.cmap_format_4 object at 0x000002A9573F25A0>, <fontTools.ttLib.tables._c_m_a_p.cmap_format_6 object at 0x000002A9573F2600>, <fontTools.ttLib.tables._c_m_a_p.cmap_format_4 object at 0x000002A9573F2630>]\n",
      "font['cmap'].tables[0].cmap type: <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "font = ttLib.TTFont('segoepr.ttf')\n",
    "print(f'font type: {type(font)}')\n",
    "print('font.keys(): ',font.keys())\n",
    "print('font[\\'cmap\\']: ',font['cmap'])\n",
    "print('font[\\'cmap\\'].tables:',font['cmap'].tables)\n",
    "print('font[\\'cmap\\'].tables[0].cmap type:',type(font['cmap'].tables[2].cmap))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "b5a6e3c6-0353-436e-9cb9-7e95c4c6ad17",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "k=font['cmap'].tables\n",
    "len(k)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "eb47c167-f499-470c-9f02-4ab7cdb8c12e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "27"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(font['head'].flags)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "300a80a0-50de-42e2-b9dd-6f76bf430333",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys([32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 462, 464, 466, 468, 470, 472, 474, 476, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 593, 609, 710, 711, 728, 729, 730, 731, 732, 733, 894, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 982, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1118, 1119, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8309, 8311, 8312, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 64257, 64258])"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(k[0].cmap.keys())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "692931b2-4815-46f9-b2e7-39ee12644cc2",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "code: 32, name: space\n",
      "code: 33, name: exclam\n",
      "code: 34, name: quotedbl\n",
      "code: 35, name: numbersign\n",
      "code: 36, name: dollar\n",
      "code: 37, name: percent\n",
      "code: 38, name: ampersand\n",
      "code: 39, name: quotesingle\n",
      "code: 40, name: parenleft\n",
      "code: 41, name: parenright\n",
      "code: 42, name: asterisk\n",
      "code: 43, name: plus\n",
      "code: 44, name: comma\n",
      "code: 45, name: hyphen\n",
      "code: 46, name: period\n",
      "code: 47, name: slash\n",
      "code: 48, name: zero\n",
      "code: 49, name: one\n",
      "code: 50, name: two\n",
      "code: 51, name: three\n",
      "code: 52, name: four\n",
      "code: 53, name: five\n",
      "code: 54, name: six\n",
      "code: 55, name: seven\n",
      "code: 56, name: eight\n",
      "code: 57, name: nine\n",
      "code: 58, name: colon\n",
      "code: 59, name: semicolon\n",
      "code: 60, name: less\n",
      "code: 61, name: equal\n",
      "code: 62, name: greater\n",
      "code: 63, name: question\n",
      "code: 64, name: at\n",
      "code: 65, name: A\n",
      "code: 66, name: B\n",
      "code: 67, name: C\n",
      "code: 68, name: D\n",
      "code: 69, name: E\n",
      "code: 70, name: F\n",
      "code: 71, name: G\n",
      "code: 72, name: H\n",
      "code: 73, name: I\n",
      "code: 74, name: J\n",
      "code: 75, name: K\n",
      "code: 76, name: L\n",
      "code: 77, name: M\n",
      "code: 78, name: N\n",
      "code: 79, name: O\n",
      "code: 80, name: P\n",
      "code: 81, name: Q\n",
      "code: 82, name: R\n",
      "code: 83, name: S\n",
      "code: 84, name: T\n",
      "code: 85, name: U\n",
      "code: 86, name: V\n",
      "code: 87, name: W\n",
      "code: 88, name: X\n",
      "code: 89, name: Y\n",
      "code: 90, name: Z\n",
      "code: 91, name: bracketleft\n",
      "code: 92, name: backslash\n",
      "code: 93, name: bracketright\n",
      "code: 94, name: asciicircum\n",
      "code: 95, name: underscore\n",
      "code: 96, name: grave\n",
      "code: 97, name: a\n",
      "code: 98, name: b\n",
      "code: 99, name: c\n",
      "code: 100, name: d\n",
      "code: 101, name: e\n",
      "code: 102, name: f\n",
      "code: 103, name: g\n",
      "code: 104, name: h\n",
      "code: 105, name: i\n",
      "code: 106, name: j\n",
      "code: 107, name: k\n",
      "code: 108, name: l\n",
      "code: 109, name: m\n",
      "code: 110, name: n\n",
      "code: 111, name: o\n",
      "code: 112, name: p\n",
      "code: 113, name: q\n",
      "code: 114, name: r\n",
      "code: 115, name: s\n",
      "code: 116, name: t\n",
      "code: 117, name: u\n",
      "code: 118, name: v\n",
      "code: 119, name: w\n",
      "code: 120, name: x\n",
      "code: 121, name: y\n",
      "code: 122, name: z\n",
      "code: 123, name: braceleft\n",
      "code: 124, name: bar\n",
      "code: 125, name: braceright\n",
      "code: 126, name: asciitilde\n",
      "code: 160, name: uni00A0\n",
      "code: 161, name: exclamdown\n",
      "code: 162, name: cent\n",
      "code: 163, name: sterling\n",
      "code: 164, name: currency\n",
      "code: 165, name: yen\n",
      "code: 166, name: brokenbar\n",
      "code: 167, name: section\n",
      "code: 168, name: dieresis\n",
      "code: 169, name: copyright\n",
      "code: 170, name: ordfeminine\n",
      "code: 171, name: guillemotleft\n",
      "code: 172, name: logicalnot\n",
      "code: 173, name: uni00AD\n",
      "code: 174, name: registered\n",
      "code: 175, name: macron\n",
      "code: 176, name: degree\n",
      "code: 177, name: plusminus\n",
      "code: 178, name: uni00B2\n",
      "code: 179, name: uni00B3\n",
      "code: 180, name: acute\n",
      "code: 181, name: mu\n",
      "code: 182, name: paragraph\n",
      "code: 183, name: periodcentered\n",
      "code: 184, name: cedilla\n",
      "code: 185, name: uni00B9\n",
      "code: 186, name: ordmasculine\n",
      "code: 187, name: guillemotright\n",
      "code: 188, name: onequarter\n",
      "code: 189, name: onehalf\n",
      "code: 190, name: threequarters\n",
      "code: 191, name: questiondown\n",
      "code: 192, name: Agrave\n",
      "code: 193, name: Aacute\n",
      "code: 194, name: Acircumflex\n",
      "code: 195, name: Atilde\n",
      "code: 196, name: Adieresis\n",
      "code: 197, name: Aring\n",
      "code: 198, name: AE\n",
      "code: 199, name: Ccedilla\n",
      "code: 200, name: Egrave\n",
      "code: 201, name: Eacute\n",
      "code: 202, name: Ecircumflex\n",
      "code: 203, name: Edieresis\n",
      "code: 204, name: Igrave\n",
      "code: 205, name: Iacute\n",
      "code: 206, name: Icircumflex\n",
      "code: 207, name: Idieresis\n",
      "code: 208, name: Eth\n",
      "code: 209, name: Ntilde\n",
      "code: 210, name: Ograve\n",
      "code: 211, name: Oacute\n",
      "code: 212, name: Ocircumflex\n",
      "code: 213, name: Otilde\n",
      "code: 214, name: Odieresis\n",
      "code: 215, name: multiply\n",
      "code: 216, name: Oslash\n",
      "code: 217, name: Ugrave\n",
      "code: 218, name: Uacute\n",
      "code: 219, name: Ucircumflex\n",
      "code: 220, name: Udieresis\n",
      "code: 221, name: Yacute\n",
      "code: 222, name: Thorn\n",
      "code: 223, name: germandbls\n",
      "code: 224, name: agrave\n",
      "code: 225, name: aacute\n",
      "code: 226, name: acircumflex\n",
      "code: 227, name: atilde\n",
      "code: 228, name: adieresis\n",
      "code: 229, name: aring\n",
      "code: 230, name: ae\n",
      "code: 231, name: ccedilla\n",
      "code: 232, name: egrave\n",
      "code: 233, name: eacute\n",
      "code: 234, name: ecircumflex\n",
      "code: 235, name: edieresis\n",
      "code: 236, name: igrave\n",
      "code: 237, name: iacute\n",
      "code: 238, name: icircumflex\n",
      "code: 239, name: idieresis\n",
      "code: 240, name: eth\n",
      "code: 241, name: ntilde\n",
      "code: 242, name: ograve\n",
      "code: 243, name: oacute\n",
      "code: 244, name: ocircumflex\n",
      "code: 245, name: otilde\n",
      "code: 246, name: odieresis\n",
      "code: 247, name: divide\n",
      "code: 248, name: oslash\n",
      "code: 249, name: ugrave\n",
      "code: 250, name: uacute\n",
      "code: 251, name: ucircumflex\n",
      "code: 252, name: udieresis\n",
      "code: 253, name: yacute\n",
      "code: 254, name: thorn\n",
      "code: 255, name: ydieresis\n",
      "code: 256, name: Amacron\n",
      "code: 257, name: amacron\n",
      "code: 258, name: Abreve\n",
      "code: 259, name: abreve\n",
      "code: 260, name: Aogonek\n",
      "code: 261, name: aogonek\n",
      "code: 262, name: Cacute\n",
      "code: 263, name: cacute\n",
      "code: 264, name: Ccircumflex\n",
      "code: 265, name: ccircumflex\n",
      "code: 266, name: Cdotaccent\n",
      "code: 267, name: cdotaccent\n",
      "code: 268, name: Ccaron\n",
      "code: 269, name: ccaron\n",
      "code: 270, name: Dcaron\n",
      "code: 271, name: dcaron\n",
      "code: 272, name: Dcroat\n",
      "code: 273, name: dcroat\n",
      "code: 274, name: Emacron\n",
      "code: 275, name: emacron\n",
      "code: 276, name: Ebreve\n",
      "code: 277, name: ebreve\n",
      "code: 278, name: Edotaccent\n",
      "code: 279, name: edotaccent\n",
      "code: 280, name: Eogonek\n",
      "code: 281, name: eogonek\n",
      "code: 282, name: Ecaron\n",
      "code: 283, name: ecaron\n",
      "code: 284, name: Gcircumflex\n",
      "code: 285, name: gcircumflex\n",
      "code: 286, name: Gbreve\n",
      "code: 287, name: gbreve\n",
      "code: 288, name: Gdotaccent\n",
      "code: 289, name: gdotaccent\n",
      "code: 290, name: uni0122\n",
      "code: 291, name: uni0123\n",
      "code: 292, name: Hcircumflex\n",
      "code: 293, name: hcircumflex\n",
      "code: 294, name: Hbar\n",
      "code: 295, name: hbar\n",
      "code: 296, name: Itilde\n",
      "code: 297, name: itilde\n",
      "code: 298, name: Imacron\n",
      "code: 299, name: imacron\n",
      "code: 300, name: Ibreve\n",
      "code: 301, name: ibreve\n",
      "code: 302, name: Iogonek\n",
      "code: 303, name: iogonek\n",
      "code: 304, name: Idotaccent\n",
      "code: 305, name: dotlessi\n",
      "code: 306, name: IJ\n",
      "code: 307, name: ij\n",
      "code: 308, name: Jcircumflex\n",
      "code: 309, name: jcircumflex\n",
      "code: 310, name: uni0136\n",
      "code: 311, name: uni0137\n",
      "code: 312, name: kgreenlandic\n",
      "code: 313, name: Lacute\n",
      "code: 314, name: lacute\n",
      "code: 315, name: uni013B\n",
      "code: 316, name: uni013C\n",
      "code: 317, name: Lcaron\n",
      "code: 318, name: lcaron\n",
      "code: 319, name: Ldot\n",
      "code: 320, name: ldot\n",
      "code: 321, name: Lslash\n",
      "code: 322, name: lslash\n",
      "code: 323, name: Nacute\n",
      "code: 324, name: nacute\n",
      "code: 325, name: uni0145\n",
      "code: 326, name: uni0146\n",
      "code: 327, name: Ncaron\n",
      "code: 328, name: ncaron\n",
      "code: 329, name: napostrophe\n",
      "code: 330, name: Eng\n",
      "code: 331, name: eng\n",
      "code: 332, name: Omacron\n",
      "code: 333, name: omacron\n",
      "code: 334, name: Obreve\n",
      "code: 335, name: obreve\n",
      "code: 336, name: Ohungarumlaut\n",
      "code: 337, name: ohungarumlaut\n",
      "code: 338, name: OE\n",
      "code: 339, name: oe\n",
      "code: 340, name: Racute\n",
      "code: 341, name: racute\n",
      "code: 342, name: uni0156\n",
      "code: 343, name: uni0157\n",
      "code: 344, name: Rcaron\n",
      "code: 345, name: rcaron\n",
      "code: 346, name: Sacute\n",
      "code: 347, name: sacute\n",
      "code: 348, name: Scircumflex\n",
      "code: 349, name: scircumflex\n",
      "code: 350, name: Scedilla\n",
      "code: 351, name: scedilla\n",
      "code: 352, name: Scaron\n",
      "code: 353, name: scaron\n",
      "code: 354, name: uni0162\n",
      "code: 355, name: uni0163\n",
      "code: 356, name: Tcaron\n",
      "code: 357, name: tcaron\n",
      "code: 358, name: Tbar\n",
      "code: 359, name: tbar\n",
      "code: 360, name: Utilde\n",
      "code: 361, name: utilde\n",
      "code: 362, name: Umacron\n",
      "code: 363, name: umacron\n",
      "code: 364, name: Ubreve\n",
      "code: 365, name: ubreve\n",
      "code: 366, name: Uring\n",
      "code: 367, name: uring\n",
      "code: 368, name: Uhungarumlaut\n",
      "code: 369, name: uhungarumlaut\n",
      "code: 370, name: Uogonek\n",
      "code: 371, name: uogonek\n",
      "code: 372, name: Wcircumflex\n",
      "code: 373, name: wcircumflex\n",
      "code: 374, name: Ycircumflex\n",
      "code: 375, name: ycircumflex\n",
      "code: 376, name: Ydieresis\n",
      "code: 377, name: Zacute\n",
      "code: 378, name: zacute\n",
      "code: 379, name: Zdotaccent\n",
      "code: 380, name: zdotaccent\n",
      "code: 381, name: Zcaron\n",
      "code: 382, name: zcaron\n",
      "code: 383, name: longs\n",
      "code: 402, name: florin\n",
      "code: 462, name: uni01CE\n",
      "code: 464, name: uni01D0\n",
      "code: 466, name: uni01D2\n",
      "code: 468, name: uni01D4\n",
      "code: 470, name: uni01D6\n",
      "code: 472, name: uni01D8\n",
      "code: 474, name: uni01DA\n",
      "code: 476, name: uni01DC\n",
      "code: 506, name: Aringacute\n",
      "code: 507, name: aringacute\n",
      "code: 508, name: AEacute\n",
      "code: 509, name: aeacute\n",
      "code: 510, name: Oslashacute\n",
      "code: 511, name: oslashacute\n",
      "code: 536, name: uni0218\n",
      "code: 537, name: uni0219\n",
      "code: 538, name: uni021A\n",
      "code: 539, name: uni021B\n",
      "code: 593, name: uni0251\n",
      "code: 609, name: uni0261\n",
      "code: 710, name: circumflex\n",
      "code: 711, name: caron\n",
      "code: 728, name: breve\n",
      "code: 729, name: dotaccent\n",
      "code: 730, name: ring\n",
      "code: 731, name: ogonek\n",
      "code: 732, name: tilde\n",
      "code: 733, name: hungarumlaut\n",
      "code: 894, name: uni037E\n",
      "code: 900, name: tonos\n",
      "code: 901, name: dieresistonos\n",
      "code: 902, name: Alphatonos\n",
      "code: 903, name: anoteleia\n",
      "code: 904, name: Epsilontonos\n",
      "code: 905, name: Etatonos\n",
      "code: 906, name: Iotatonos\n",
      "code: 908, name: Omicrontonos\n",
      "code: 910, name: Upsilontonos\n",
      "code: 911, name: Omegatonos\n",
      "code: 912, name: iotadieresistonos\n",
      "code: 913, name: Alpha\n",
      "code: 914, name: Beta\n",
      "code: 915, name: Gamma\n",
      "code: 916, name: uni0394\n",
      "code: 917, name: Epsilon\n",
      "code: 918, name: Zeta\n",
      "code: 919, name: Eta\n",
      "code: 920, name: Theta\n",
      "code: 921, name: Iota\n",
      "code: 922, name: Kappa\n",
      "code: 923, name: Lambda\n",
      "code: 924, name: Mu\n",
      "code: 925, name: Nu\n",
      "code: 926, name: Xi\n",
      "code: 927, name: Omicron\n",
      "code: 928, name: Pi\n",
      "code: 929, name: Rho\n",
      "code: 931, name: Sigma\n",
      "code: 932, name: Tau\n",
      "code: 933, name: Upsilon\n",
      "code: 934, name: Phi\n",
      "code: 935, name: Chi\n",
      "code: 936, name: Psi\n",
      "code: 937, name: uni03A9\n",
      "code: 938, name: Iotadieresis\n",
      "code: 939, name: Upsilondieresis\n",
      "code: 940, name: alphatonos\n",
      "code: 941, name: epsilontonos\n",
      "code: 942, name: etatonos\n",
      "code: 943, name: iotatonos\n",
      "code: 944, name: upsilondieresistonos\n",
      "code: 945, name: alpha\n",
      "code: 946, name: beta\n",
      "code: 947, name: gamma\n",
      "code: 948, name: delta\n",
      "code: 949, name: epsilon\n",
      "code: 950, name: zeta\n",
      "code: 951, name: eta\n",
      "code: 952, name: theta\n",
      "code: 953, name: iota\n",
      "code: 954, name: kappa\n",
      "code: 955, name: lambda\n",
      "code: 956, name: uni03BC\n",
      "code: 957, name: nu\n",
      "code: 958, name: xi\n",
      "code: 959, name: omicron\n",
      "code: 960, name: pi\n",
      "code: 961, name: rho\n",
      "code: 962, name: sigma1\n",
      "code: 963, name: sigma\n",
      "code: 964, name: tau\n",
      "code: 965, name: upsilon\n",
      "code: 966, name: phi\n",
      "code: 967, name: chi\n",
      "code: 968, name: psi\n",
      "code: 969, name: omega\n",
      "code: 970, name: iotadieresis\n",
      "code: 971, name: upsilondieresis\n",
      "code: 972, name: omicrontonos\n",
      "code: 973, name: upsilontonos\n",
      "code: 974, name: omegatonos\n",
      "code: 982, name: omega1\n",
      "code: 1025, name: uni0401\n",
      "code: 1026, name: uni0402\n",
      "code: 1027, name: uni0403\n",
      "code: 1028, name: uni0404\n",
      "code: 1029, name: uni0405\n",
      "code: 1030, name: uni0406\n",
      "code: 1031, name: uni0407\n",
      "code: 1032, name: uni0408\n",
      "code: 1033, name: uni0409\n",
      "code: 1034, name: uni040A\n",
      "code: 1035, name: uni040B\n",
      "code: 1036, name: uni040C\n",
      "code: 1038, name: uni040E\n",
      "code: 1039, name: uni040F\n",
      "code: 1040, name: uni0410\n",
      "code: 1041, name: uni0411\n",
      "code: 1042, name: uni0412\n",
      "code: 1043, name: uni0413\n",
      "code: 1044, name: uni0414\n",
      "code: 1045, name: uni0415\n",
      "code: 1046, name: uni0416\n",
      "code: 1047, name: uni0417\n",
      "code: 1048, name: uni0418\n",
      "code: 1049, name: uni0419\n",
      "code: 1050, name: uni041A\n",
      "code: 1051, name: uni041B\n",
      "code: 1052, name: uni041C\n",
      "code: 1053, name: uni041D\n",
      "code: 1054, name: uni041E\n",
      "code: 1055, name: uni041F\n",
      "code: 1056, name: uni0420\n",
      "code: 1057, name: uni0421\n",
      "code: 1058, name: uni0422\n",
      "code: 1059, name: uni0423\n",
      "code: 1060, name: uni0424\n",
      "code: 1061, name: uni0425\n",
      "code: 1062, name: uni0426\n",
      "code: 1063, name: uni0427\n",
      "code: 1064, name: uni0428\n",
      "code: 1065, name: uni0429\n",
      "code: 1066, name: uni042A\n",
      "code: 1067, name: uni042B\n",
      "code: 1068, name: uni042C\n",
      "code: 1069, name: uni042D\n",
      "code: 1070, name: uni042E\n",
      "code: 1071, name: uni042F\n",
      "code: 1072, name: uni0430\n",
      "code: 1073, name: uni0431\n",
      "code: 1074, name: uni0432\n",
      "code: 1075, name: uni0433\n",
      "code: 1076, name: uni0434\n",
      "code: 1077, name: uni0435\n",
      "code: 1078, name: uni0436\n",
      "code: 1079, name: uni0437\n",
      "code: 1080, name: uni0438\n",
      "code: 1081, name: uni0439\n",
      "code: 1082, name: uni043A\n",
      "code: 1083, name: uni043B\n",
      "code: 1084, name: uni043C\n",
      "code: 1085, name: uni043D\n",
      "code: 1086, name: uni043E\n",
      "code: 1087, name: uni043F\n",
      "code: 1088, name: uni0440\n",
      "code: 1089, name: uni0441\n",
      "code: 1090, name: uni0442\n",
      "code: 1091, name: uni0443\n",
      "code: 1092, name: uni0444\n",
      "code: 1093, name: uni0445\n",
      "code: 1094, name: uni0446\n",
      "code: 1095, name: uni0447\n",
      "code: 1096, name: uni0448\n",
      "code: 1097, name: uni0449\n",
      "code: 1098, name: uni044A\n",
      "code: 1099, name: uni044B\n",
      "code: 1100, name: uni044C\n",
      "code: 1101, name: uni044D\n",
      "code: 1102, name: uni044E\n",
      "code: 1103, name: uni044F\n",
      "code: 1105, name: uni0451\n",
      "code: 1106, name: uni0452\n",
      "code: 1107, name: uni0453\n",
      "code: 1108, name: uni0454\n",
      "code: 1109, name: uni0455\n",
      "code: 1110, name: uni0456\n",
      "code: 1111, name: uni0457\n",
      "code: 1112, name: uni0458\n",
      "code: 1113, name: uni0459\n",
      "code: 1114, name: uni045A\n",
      "code: 1115, name: uni045B\n",
      "code: 1116, name: uni045C\n",
      "code: 1118, name: uni045E\n",
      "code: 1119, name: uni045F\n",
      "code: 1168, name: uni0490\n",
      "code: 1169, name: uni0491\n",
      "code: 7808, name: Wgrave\n",
      "code: 7809, name: wgrave\n",
      "code: 7810, name: Wacute\n",
      "code: 7811, name: wacute\n",
      "code: 7812, name: Wdieresis\n",
      "code: 7813, name: wdieresis\n",
      "code: 7922, name: Ygrave\n",
      "code: 7923, name: ygrave\n",
      "code: 8211, name: endash\n",
      "code: 8212, name: emdash\n",
      "code: 8213, name: uni2015\n",
      "code: 8215, name: underscoredbl\n",
      "code: 8216, name: quoteleft\n",
      "code: 8217, name: quoteright\n",
      "code: 8218, name: quotesinglbase\n",
      "code: 8219, name: quotereversed\n",
      "code: 8220, name: quotedblleft\n",
      "code: 8221, name: quotedblright\n",
      "code: 8222, name: quotedblbase\n",
      "code: 8224, name: dagger\n",
      "code: 8225, name: daggerdbl\n",
      "code: 8226, name: bullet\n",
      "code: 8230, name: ellipsis\n",
      "code: 8240, name: perthousand\n",
      "code: 8242, name: minute\n",
      "code: 8243, name: second\n",
      "code: 8249, name: guilsinglleft\n",
      "code: 8250, name: guilsinglright\n",
      "code: 8252, name: exclamdbl\n",
      "code: 8254, name: uni203E\n",
      "code: 8260, name: fraction\n",
      "code: 8309, name: uni2075\n",
      "code: 8311, name: uni2077\n",
      "code: 8312, name: uni2078\n",
      "code: 8319, name: uni207F\n",
      "code: 8355, name: franc\n",
      "code: 8356, name: lira\n",
      "code: 8359, name: peseta\n",
      "code: 8364, name: Euro\n",
      "code: 8453, name: uni2105\n",
      "code: 8467, name: uni2113\n",
      "code: 8470, name: uni2116\n",
      "code: 8482, name: trademark\n",
      "code: 8486, name: Omega\n",
      "code: 8494, name: estimated\n",
      "code: 8539, name: oneeighth\n",
      "code: 8540, name: threeeighths\n",
      "code: 8541, name: fiveeighths\n",
      "code: 8542, name: seveneighths\n",
      "code: 8592, name: arrowleft\n",
      "code: 8593, name: arrowup\n",
      "code: 8594, name: arrowright\n",
      "code: 8595, name: arrowdown\n",
      "code: 8596, name: arrowboth\n",
      "code: 8597, name: arrowupdn\n",
      "code: 8616, name: arrowupdnbse\n",
      "code: 8706, name: partialdiff\n",
      "code: 8710, name: Delta\n",
      "code: 8719, name: product\n",
      "code: 8721, name: summation\n",
      "code: 8722, name: minus\n",
      "code: 8730, name: radical\n",
      "code: 8734, name: infinity\n",
      "code: 8735, name: orthogonal\n",
      "code: 8745, name: intersection\n",
      "code: 8747, name: integral\n",
      "code: 8776, name: approxequal\n",
      "code: 8800, name: notequal\n",
      "code: 8801, name: equivalence\n",
      "code: 8804, name: lessequal\n",
      "code: 8805, name: greaterequal\n",
      "code: 8962, name: house\n",
      "code: 8976, name: revlogicalnot\n",
      "code: 8992, name: integraltp\n",
      "code: 8993, name: integralbt\n",
      "code: 9472, name: SF100000\n",
      "code: 9474, name: SF110000\n",
      "code: 9484, name: SF010000\n",
      "code: 9488, name: SF030000\n",
      "code: 9492, name: SF020000\n",
      "code: 9496, name: SF040000\n",
      "code: 9500, name: SF080000\n",
      "code: 9508, name: SF090000\n",
      "code: 9516, name: SF060000\n",
      "code: 9524, name: SF070000\n",
      "code: 9532, name: SF050000\n",
      "code: 9552, name: SF430000\n",
      "code: 9553, name: SF240000\n",
      "code: 9554, name: SF510000\n",
      "code: 9555, name: SF520000\n",
      "code: 9556, name: SF390000\n",
      "code: 9557, name: SF220000\n",
      "code: 9558, name: SF210000\n",
      "code: 9559, name: SF250000\n",
      "code: 9560, name: SF500000\n",
      "code: 9561, name: SF490000\n",
      "code: 9562, name: SF380000\n",
      "code: 9563, name: SF280000\n",
      "code: 9564, name: SF270000\n",
      "code: 9565, name: SF260000\n",
      "code: 9566, name: SF360000\n",
      "code: 9567, name: SF370000\n",
      "code: 9568, name: SF420000\n",
      "code: 9569, name: SF190000\n",
      "code: 9570, name: SF200000\n",
      "code: 9571, name: SF230000\n",
      "code: 9572, name: SF470000\n",
      "code: 9573, name: SF480000\n",
      "code: 9574, name: SF410000\n",
      "code: 9575, name: SF450000\n",
      "code: 9576, name: SF460000\n",
      "code: 9577, name: SF400000\n",
      "code: 9578, name: SF540000\n",
      "code: 9579, name: SF530000\n",
      "code: 9580, name: SF440000\n",
      "code: 9600, name: upblock\n",
      "code: 9604, name: dnblock\n",
      "code: 9608, name: block\n",
      "code: 9612, name: lfblock\n",
      "code: 9616, name: rtblock\n",
      "code: 9617, name: ltshade\n",
      "code: 9618, name: shade\n",
      "code: 9619, name: dkshade\n",
      "code: 9632, name: filledbox\n",
      "code: 9633, name: H22073\n",
      "code: 9642, name: H18543\n",
      "code: 9643, name: H18551\n",
      "code: 9644, name: filledrect\n",
      "code: 9650, name: triagup\n",
      "code: 9658, name: triagrt\n",
      "code: 9660, name: triagdn\n",
      "code: 9668, name: triaglf\n",
      "code: 9674, name: lozenge\n",
      "code: 9675, name: circle\n",
      "code: 9679, name: H18533\n",
      "code: 9688, name: invbullet\n",
      "code: 9689, name: invcircle\n",
      "code: 9702, name: openbullet\n",
      "code: 9786, name: smileface\n",
      "code: 9787, name: invsmileface\n",
      "code: 9788, name: sun\n",
      "code: 9792, name: female\n",
      "code: 9794, name: male\n",
      "code: 9824, name: spade\n",
      "code: 9827, name: club\n",
      "code: 9829, name: heart\n",
      "code: 9830, name: diamond\n",
      "code: 9834, name: musicalnote\n",
      "code: 9835, name: musicalnotedbl\n",
      "code: 64257, name: uniFB01\n",
      "code: 64258, name: uniFB02\n"
     ]
    }
   ],
   "source": [
    "for code,name in k[0].cmap.items():\n",
    "    print(f'code: {code}, name: {name}')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "d9da1543-60af-47ac-9221-4092a09f6010",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<bound method NameRecord.toUnicode of <NameRecord NameID=1; PlatformID=3; LanguageID=1033>>\n"
     ]
    }
   ],
   "source": [
    "print(font['name'].getName(1,3,1).toUnicode)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:ai]",
   "language": "python",
   "name": "conda-env-ai-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
